<!DOCTYPE html>
<html style="font-size: 47px; visibility: visible;">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="/nzzpay/aliBillReset.css">
    <link rel="stylesheet" href="/nzzpay/aliBillPayCode.css">
    <link rel="stylesheet" type="text/css" href="/nzzpay/layer.css" />

    <script src="/nzzpay/jquery.min.js"></script>
    <script src="/nzzpay/layer.js"></script>
    <script src="/js/reconnecting-websocket.js"></script>

    <title>支付宝官方在线充值</title>
    <meta name="__hash__" content="0b742ffc556e4ad2190002bca5a1369f_9e5bf7e290c0f643e6bc0f0e6e44f31d">
    <meta name="__hash__" content="da355ba92c461c0a8619b302ecef7cc3_13bc948e81249198c30844ebbe431df1">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
</head>
<!-- 适配代码 -->
<body style="visibility: visible;">

<script>
    (function(doc, win) {
        var docEl = doc.documentElement,
            resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
            recalc = function() {
                var clientWidth = docEl.clientWidth;
                if (!clientWidth)
                    return;
                docEl.style.fontSize = parseInt(100 * ((clientWidth > 750 ? 750 : clientWidth) / 750)) + 'px';
            };
        if (!doc.addEventListener)
            return;
        win.addEventListener(resizeEvt, recalc, false);
        doc.addEventListener('DOMContentLoaded', recalc, false);
    })(document, window);
</script>
<br>
<div class="paytotalbox">
    <div class="payicon">
    </div>
    <div class="payalert">
        付款成功后将自动充值到账</div>
    <div class="centerline">
    </div>
    <div class="ordernumber">
        订单号：${tradeNo!}</div>
    <div class="paynumbox">
        <div class="paynumtitle">
            充值金额：</div>
        <div class="paynumber">
            <span class="moneyicon">¥</span><span id="moneynum">
                    ${amount!}</span></div>
    </div>
    <div class="copybutton" style="background-color: rgb(237, 205, 144); color: rgb(51, 51, 51);">
        <span></span>
        <div id="fill" style="width: 100%;">
        </div>
        <div id="showNumber">
            立即支付</div>
    </div>

    <div class="paytimehint">
        <b style="font-size: 16px;">订单正在创建中，请耐心等待！</b><span id="Span1"></span></div>
    <div class="paytimehint" style="font-size: 16px; color: #00F; line-height: 25px;">
        为了确保您100%支付成功，<b style="font-size: 16px;">请勿退出</b>，谢谢！</div>
</div>
<!-- 分割线 -->
<div class="line">
</div>
<!-- 说明部分 -->
<div class="explainbox">
    <div class="explainitem">
        <div class="explainicon explainiconone">
        </div>
        <div class="explaintext">
            ①温馨提示</div>
        <div class="explainLine">
        </div>
    </div>
    <div class="explainitem">
        <div class="explainicon explainicontwo">
        </div>
        <div class="explaintext">
            ②请勿修改金额,直接付款即可！</div>
        <div class="explainLine">
        </div>
    </div>
    <div class="explainitem explainitemtwo">
        <div class="explainicon explainicontwo">
        </div>
        <div class="explaintext">
            ③否则会导致支付不到账</div>
    </div>
    <!-- 温馨提示 -->
    <div class="hintTitlebox">
        <div class="hintTitletext">
            温馨提示</div>
        <div class="hintLine">
        </div>
    </div>
    <div class="hintdesc">
        ①请勿修改金额<span></span>，否则会导致支付不到账
    </div>
    <div class="hintdesc">
        ④请勿修改金额<span></span>，直接付款即可！！！
    </div>
    <input type="hidden" value="" class="url">
</div>

<script src="/nzzpay/alipayjsapi.inc.min.js"></script>

<script type="text/javascript">
    if (navigator.userAgent.match(/Alipay/i)) {
        // location.href="alipays://platformapi/startapp?appId=09999988&actionType=toAccount&goBack=NO&amount=1&userId=2088122000429149&memo=5606920191223544953";
    } else {
        //location.href = "/api/nzzpay/pay_cs.html";
    }

    var uid = "${alipayUserId!}";
    var amount = "${amount!}";
    var memo = "${tradeNo!}";
    //var go_url = "alipayqr://platformapi/startapp?saId=20000200&actionType=toAccount&account=&userId=" + uid + "&amount=" + amount + "&memo=";
    //var go_url = "alipays://platformapi/startapp?appId=09999988&actionType=toAccount&goBack=NO&amount=" + amount + "&userId=" + uid + "&memo=" + memo;
    var go_url = 'alipayqr://platformapi/startapp?appId=20000123&actionType=scan&biz_data={"s": "money","u": "'+uid+'","a": "'+amount+'","m": "'+memo+'"}';

    // 解决渲染页面缩放
    setTimeout(function () {
        document.querySelector("body").style.visibility = "visible"
        document.querySelector("html").style.visibility = "visible"
    }, 0);
    $(".backbox").click(function () {
        window.history.back();
    })

    // $(".copybutton").click(function () {
    //     ss();
    // })
    function sleep(delay) {
        var start = (new Date()).getTime();
        while ((new Date()).getTime() - start < delay) {
            continue;
        }
    }
    //成功获取到url后更改按钮样式
    function timeInterval() {
        $('.copybutton').text("立即支付");
        $('.copybutton').css({
            'background-color': '#EDCD90',
            'color': '#333333'
        });
    }

    // 加载js进度条
    var fill = document.getElementById('fill');
    var showNumber = document.getElementById('showNumber');
    var paytimehint = document.getElementById('paytimehint');
    var count = 0
    var t = "15";
    var t1 = 700;
    var t2 = 1000
    var t3 = 1000;
    var t4 = 1000;
    //var t1 = 200;
    //var t2 = 350
    //var t3 = 350;
    //var t4 = 250;

    initone();
    function initone() {
        $('.copybutton').css({
            'backgroundColor': '#CCCCCC',
            'color': '#777777'
        })
        $('.copybutton>span').text('');
        var timerone = setInterval(function () {
            count++;
            showNumber.innerHTML = count + '% 【请耐心等待，勿退出】';
            //paytimehint.innerHTML = t + "s";
            fill.style.width = count + '%';
            if (count === 33) {
                clearInterval(timerone);
                inittwo();
            }
        }, t1)
    }
    function inittwo() {
        var timertwo = setInterval(function (e) {
            count++;
            showNumber.innerHTML = count + '% 【请耐心等待，勿退出】';
            fill.style.width = count + '%';
            if (count === 50) {
                clearInterval(timertwo);
                initthree()
            }

        }, t2);
    }
    function initthree() {
        var timerthree = setInterval(function (e) {
            count++;
            showNumber.innerHTML = count + '% 【请耐心等待，勿退出】';
            fill.style.width = count + '%';
            if (count === 80) {
                clearInterval(timerthree);
                initfour();
            }

        }, t3);
    }
    function initfour() {
        var timerfour = setInterval(function (e) {
            count++;
            showNumber.innerHTML = count + '% 【请耐心等待，勿退出】';
            fill.style.width = count + '%';
            if (count >= 100) {
                suctime();
                clearInterval(timerfour);
            }

        }, t4);
    }

    function suctime() {
        showNumber.innerHTML = "立即支付"
        $('.copybutton').css({
            'background-color': '#EDCD90',
            'color': '#333333'
        });

        setTimeout(function () {

            //AlipayJSBridge.call("exitApp");
            window.location.href = go_url;
        }, 300);

        // getred()
        $('.copybutton').on('click', function () {
            window.location.href = go_url;
        });
    }
    var e = "如果出现支付失败的情况该怎么办？";
    var f = "请到聊天窗口选择最近的一条收款信息进行付款";
    // var f = url;
    var g = "确定";
    function ss() {
        AlipayJSBridge.call('alert', {
            title: e,
            message: f,
            button: g
        }, function (e) {
            setTimeout(function () {
                $('.url').val(go_url);
                window.location.href = go_url;
                // dizhi();
            }, 1);
        });
    }

    func1();
    function func1() {
        var i = 10;
        var interval;
        layer.confirm( '1.请充值指定金额￥【<span style="color:red; font-size:16px;">${amount!}</span>】元！<br/>2.为了确保您100%支付成功，<b style="color:red;">请勿退出！</b><br/><span style="color:red;">3.请不要重复支付！请不要修改金额！</span>', {
            icon: 1,
            title: '支付须知',
            btn: ['等待' + i + 1 + '秒'], //按钮
            //skin: 'layui-layer-molv',
            success: function (a, b) {
                var fn = function () {
                    //       layer.title(i+' 秒后，系统将自动退出并关闭。',b);
                    $(".layui-layer-btn0").text('等待' + i + '秒');
                    $(".layui-layer-btn0").attr("disabled", "disabled");
                    i--;
                };
                interval = setInterval(function () {
                    fn();
                    if (i === 0) {
                        $(".layui-layer-btn0").text('朕知道了！！！');
                        $(".layui-layer-btn0").removeAttr("disabled");
                        clearInterval(interval);
                    }
                }, 1000);
            },
            end: function () {
                clearInterval(interval);
            }
        }, function () {
            if (i <= 0) {
                layer.msg('订单创建中，请勿退出！', { time: 1500 });
            }

        }, function () {
            clearInterval(interval);
//                layer.msg('进度相对缓慢，请耐心等待！', { icon: 1 });
            layer.msg('订单创建中，请勿退出！', { time: 1500 });

        });
    }

    $(function () {
        //WebSocket监听， 等待接收订单支付成功的消息
        if(typeof(WebSocket) != "undefined") {
            //打开监听事件
            var socket = new ReconnectingWebSocket("${wsAddress!}");
            socket.onopen = function(){};

            //获得消息事件
            socket.onmessage = function(msgObject) {

                var resDataJSON = JSON.parse(msgObject.data);

                if(resDataJSON.state == '2' || resDataJSON.state == '3'){ //支付成功
                    layer.alert(
                        '支付成功',
                        {title: '支付提示', icon: 1},
                        function (index) {
                            layer.close(index);
                            AlipayJSBridge.call("exitApp");
                        });
                }else if(resDataJSON.state == '-2'){ //支付超时
                    layer.alert(
                        '支付超时,请重新下单',
                        {title: '支付提示', icon: 5},
                        function (index) {
                            layer.close(index);
                            AlipayJSBridge.call("exitApp");
                        });
                }
            };
        }

    });

</script>

<div>
    <div>
    </div>
</div>
<div id="chooseContact">
</div>
<div id="chooseImage">
</div>
<div id="datePicker">
</div>
<div id="lifestyle">
</div>
<div id="pickerview">
</div>
<div>
    <div>
    </div>
</div>
</body>
</html>